home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
386
/
a68
/
as68help.doc
< prev
next >
Wrap
Text File
|
1985-11-19
|
10KB
|
178 lines
AS68 Helper
A SPECIAL INCLUSION LISTING ON DISK AND ON DELPHI ATARI USERS' GROUP
A tutorial and utility program for users of DRI's AS68 assembler.
by Charles F. Johnson
This article won't teach you 68000 assembly language, but it will show you how
to set up a disk with all the files necessary to edit, assemble and debug
programs using DRI's AS68 assembler, as supplied with the Atari Developer's
Kit. And there's a nice treat included for anyone who uses AS68; a utility
program that can greatly simplify the whole editing and compiling process.
This utility, the AS68 Helper, acts as a sort of dispatcher program, letting
you edit, assemble (with several different options), or debug your code--all
with the click of a mouse button!
The process of editing and compiling an assembly language program on the ST is
nowhere near as straightforward as on the Atari 8-bit models. If you're used
to the speed and (relative) simplicity of MAC/65 by OSS (to name one excellent
8-bit assembler), the complexity of the AS68 package can be very discouraging.
With MAC/65 and most 8-bit assemblers, the editor, assembler and debugger
programs are all resident in memory at once. On the ST, you'll need at least
ten programs (all disk resident) to develop a program. But cheer up; C
programmers are even worse off in this respect.
In any case, the most important tool for anyone using the AS68 assembler is a
RAMdisk, which sets aside part of the computer's memory to simulate a floppy
disk drive. You can drastically speed up the assembly process by copying all
the necessary files to the RAMdisk and doing your work from there. There are
many commercial and public domain RAMdisk programs out for the ST; if you don't
have one yet, there are several on the ANALOG Computing/ST-Log Atari Users'
Group on Delphi. And many of the public domain versions are just as good as
(in some cases, better than) the ones you pay for.
A RAMdisk is not absolutely necessary to use AS68; you can, of course,
assemble just as well from a normal disk drive. But it will definitely make
your life easier! Just remember to copy your source files to a real disk
before turning off the computer and sending your RAMdisk to bit heaven.
I'll assume you're using the MicroEMACS text editor that comes with the
Developer's Kit, but if you prefer a different editor, just substitute its name
for EMACS.TTP in the discussion that follows. Please note that whichever
editor you use, you must save source code with a filename extension of .S--the
AS68 assembler doesn't accept others.
The files you'll need from the Developer's Kit disks are:
BATCH.TTP......The batch file processor (uses AS.BAT, see below)
EMACS.TTP......Text editor
SID.TTP........DRI's symbolic debugger
AS68.PRG.......The assembler
AS68SYMB.DAT...A data file which is read by the assembler
LINK68.PRG.....The linker
RELMOD.PRG.....The relocator; creates a relocatable .PRG file
RM.PRG.........File deleter to remove intermediate files
WAIT.PRG.......Waits for a keypress after assembly
In addition to these files, you also need to create a file called AS.BAT (you
can call it anything, actually, but the extension must always be .BAT). This
file contains the commands for BATCH.TTP, which is the program you double-click
on to begin an assembly; it reads the AS.BAT file and executes the list of
commands contained therein. To perform a simple assembly, with no listing or
symbol table, you should enter the following text into your editor:
as68 -l -u %1.s
link68 [u] %1.68k=1.o
relmod %1.68k %1.prg
rm %1.68k
rm %1.o
wait
Save this with the name AS.BAT; you now have a complete assembler disk. Copy
these ten files, plus your source code, to your RAMdisk. When you've finished
editing the source code for a program, save it and double-click on BATCH.TTP.
A GEM dialog box appears to allow you to enter parameters for BATCH; enter the
following text:
as source
You would replace source with the name of your source code file. Please note
that you should omit the .S extension or the assembler may delete your source
code; so be careful! Press RETURN or click on the OK button, and the assembly
will begin. As BATCH calls the programs, the screen will show which one is
currently active. Any errors will be printed, and, finally, you should see a
message telling you to press RETURN. When you do, you'll be back at the GEM
desktop, and a file with the same name as your source code but an extension of
.PRG will now be present on the disk (or RAMdisk, as the case may be). This
is, of course, your assembled program, which may be run like any other GEM
program, or inspected and debugged with the SID debugger. (See the Developer's
Kit documentation for more details on the operation of SID.)
And now...AS68 Helper!
AS68 Helper is a utility that can greatly speed up the assembly process. To
install it, you should click once on the file called ASM_EDIT.PRG (included on
this month's ST-Log disk and on our Atari Users' Group on Delphi), and then
move up to the options menu heading on the desktop and select INSTALL
APPLICATION. For the document type, enter S and click on the OK button (don't
press RETURN...the default in this dialog box is CANCEL). Now, whenever you
double-click on a file with an extension of .S (a source code file), AS68
Helper will load first and present you with a GEM menu bar with two titles,
"Desk" and "File." Note: you don't have to go through the INSTALL APPLICATION
procedure every time. Just do it once and save your desktop.
The menus work in typical GEM fashion: just move the mouse to one of the
titles, and a box will drop down containing several choices. If you don't want
to use the mouse, you can simply type the first letter of any menu selection
while there are no menus pulled down (e.g. E for Edit, A for Assemble, etc.)
The desk menu allows you to access any desk accessories you have installed, and
also lets you view the AS68 Helper title box. The file menu lets you edit,
assemble, or debug your program--AS68 Helper uses the GEMDOS EXEC function to
call EMACS.TTP, BATCH. TTP, or SID.PRG. These programs, along with the others
mentioned above (including ASM_EDIT.PRG) must all be present in the same
directory with the source code (they're already on the RAMdisk anyway, right?)
If there is no .PRG file on the disk with the same name as the source, the
DEBUG option will appear in lighter type, to show that it is not currently
accessible.
The "Print" option lets you send the source file you're working on to any type
of printer. A dialog box allows you to choose pica, emphasized, elite,
condensed, or nearletter-quality type, set your left margins, and skip over the
paper's perforations. (These print options only work with Epson/Star and
compatible printers.) There is also an option to expand tabs to any number of
spaces (the default is 8); note that the tab space setting works for any
printer, not just the Epson clan, since it expands TAB characters to strings of
spaces. After starting a printout, you can abort it by pressing any key.
The file menu also lets you select a different source file to work on. Choose
"New Source File" and a "File Selector" box will appear, showing all files with
an extension of .S in the current directory. Since all the assembler programs
must be in the same directory as your source code, you may not change
directories with the File Selector. If you try, you'll see an alert box with
the message Source and assembler files must be in the directory you started
with...To edit several different source files during a session, just copy them
all to the same directory.
When you select "Assemble," another dialog box will let you choose from
several assembly options. You can specify the extension of the output file
(.PRG, .ACC, .TOS, or .TTP) and choose from three preset types of assembly--a
simple assembly, an assembly which produces a listing file with extension of
.ASM, or an assembly which includes in the .PRG file the actual labels used in
your source (this is called a "symbol table"). When a .PRG file with symbol
table is examined with SID, you can refer to the same labels as the ones you
used in your source code, which greatly facilitates debugging. In addition to
these preset types, you can also choose "Batch File" (see below) to customize
the assembly. (Batch files must be in the same directory as all the other
files.) By the way, when you use AS68 Helper, you can eliminate WAIT.PRG from
your assembler disk. If you use a preset assembly type, you can eliminate
RM.PRG, too.
The key to producing these different types of assemblies is in creating the
proper .BAT file for BATCH.TTP. AS68 Helper writes a new AS.BAT file to the
disk every time you assemble, based on your choice. The source code file on
the ST-Log disk and Atari Users' Group is called ASMEDIT.S. There you can see
how these batch files should look. Bear in mind that there are many more
possibilities for customizing batch files. The three choices that AS68 Helper
gives you are not your only options!
The source code also shows how to include object trees directly into an
assembly language program, instead of using a separate resource file created by
the GEM Resource Construction Set, as well as a number of other interesting
techniques. I would like to extend special thanks to my friend Barnaby Finch,
who provided much of the information about setting up an assembler disk.
A final note on using different editors: you have two options if you want to
use AS68 Helper with an editor other than MicroEMACS. You can simply rename
your editor EMACS.TTP (this works in most cases, unless the text editor is
GEM-based, like 1st Word), or edit the source code for AS68 Helper to use the
new name. If you choose the latter, you'll probably have to adjust some loops
and some counters, as well as the obvious filename specifiers. The source is
pretty well commented and should be fairly easy to follow. Have fun...and may
all your assemblies be error-free!
ə